The present invention relates to an image processing method and system, and more specifically an image processing method and system for generating a palette.
One important issue related to publishing images to the Internet is the size of the image file. Internet or World Wide Web images must both load quickly and look good. Looking good often depends on the number of colours, hence the better looking the image, the larger the number of colours. The disadvantage to a large number of colours is a larger size of the image file. A large image file will slow the loading time for the image and hence the Web page will load slower. A slow loading time is not desirable since many people viewing the Web page will not tolerate the wait and leave the Web page before the page is finished loading. For this reason, producing Web-page images is a compromise between file size and image quality. It is therefore desirable for an image posted to the Internet to look as good as possible, but it""s file size must be small enough so that the person viewing the image will wait for it to load.
One known method to reduce the image files to a manageable size for Internet publishing is to compress the file. Unfortunately, the data compression process usually results in some loss of quality. The trick is to lose as little colour quality as possible while reducing the file size. One such way to reduce the size of image files is to reduce the number of colours in them.
Absolute colours images, that is images with a large number of colours, such as up to 16 million colours for example, store up to three 8-bit values for each pixel to determine the colour. Therefore, one way to reduce the image file size would be to store less than these three values. Representing colour in this way is known as a paletted image. A paletted image is uses a relatively small number of colours, often less than 256 and even as low as 8 or 4 colours. If 256 colours or less are used then a single value of 8 bits or less can be used to represent the colours in the image. Therefore, the image file will be smaller in size as compared to that of the absolute colour image. The size of a typical paletted image file is m*n+2k bytes, where the image is m pixels wide by n pixels high and 2 kbytes are used to store the colours. A typical absolute colour image file storing three 8-bit values for each colour is m*n*3 bytes, because each of the m*n pixels has three 8-bit colour values.
Paletted image files store the set of possible colours in a table. The colour of each pixel is represented by one of the entries in this table. The table is called a palette. There are standard palettes available that have a predetermined set of colours.
If an image is converted from a large number of colours, such as 16 million colours, to a small number of colours, such as a less than 256 colour paletted image, there will be some loss of image quality. However, if care is taken when selecting the colours in the palette, acceptable results can be obtained. Therefore, the quality of the colour representation in a paletted image depends on the quality of its associated palette.
Systems and methods to generate palettes in order to reduce the number of colours in a image are well known in the art. Often, these methods consider all the image colours as having the same importance. Therefore, the palette entries are more likely to represent the colours that occur most often in the image.
If the colours of the area of interest in the image do not correspond to the colours that occur most often in the image, then there will be a low number of entries in the palette representing the colours of interest. Hence, the area of interest will not have an acceptable colour representation.
Therefore, when reducing the size of an image by reducing the number of colours, the problem is maintaining an acceptable colour representation in an area of interest that is most similar to the area of interest in the original image. Also, it is desirable to let the user decide what is an acceptable similarity to the original image.
For the foregoing reasons, there is a need to provide a palette for use to achieve an acceptable colour representation in a paletted image.
The present invention is directed to an image processing system and method for generating a palette to provide a palette for use to achieve an acceptable colour representation in a paletted image for an area of the image regardless of how often the colours in the area of interest occur relative to the rest of the image.
An embodiment of the invention is an image processing method comprising the steps of: determining a most important colour; for each pixel in an image, each of the pixels having a pixel colour, determining a pixel colour weight using the most important colour and the pixel colour; and generating the palette using the pixel colours and the pixel colour weights.
Another embodiment of the invention is an image processing method comprises the steps of: determining a most important colour; for each pixel in an image, each of the pixels having a pixel colour, determining a colour difference by comparing the pixel colour with the most important colour to and then determining a pixel colour weight for each pixel colour using each colour difference; and generating the palette using the pixel colours and the pixel colour weights.
Another embodiment of the invention is an image processing system for generating a palette, the image processing system comprising: means for determining a most important colour; for each pixel in an image, each of the pixels having a pixel colour, means for determining a pixel colour weight using the most important colour and the pixel colour; and means for generating the palette using the pixel colours and the pixel colour weights.
Further, another embodiment of the invention is an image processing product embodied on a computer-readable storage medium for generating a palette, the image processing product comprising: means recorded on the medium for determining a most important colour; for each pixel in an image, each of the pixels having a pixel colour, means recorded on the medium for determining a pixel colour weight using the most important colour and the pixel colour; and means recorded on the medium for generating the palette using the pixel colours and the pixel colour weights.
Moreover, another embodiment of the invention is an image processing product embodied in a carrier wave for generating a palette, the image processing product comprising: means embodied in the carrier wave for determining a most important colour; for each pixel in an image, each of the pixels having a pixel colour, embodied in the carrier wave for determining a pixel colour weight using the most important colour and the pixel colour; and means embodied in the carrier wave for generating the palette using the pixel colours and the pixel colour weights.
An advantage of the invention is that the palette that is generated produces a corresponding paletted image that contains the area of interest that is more similar to the original image in terms of colour.